const { DataTypes } = require("sequelize");

const seq = require("../DB/seq");

const Document = seq.define(
  "mac_document",
  {
    docName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "未命名",
      comment: "文件夹本身的名字",
    },
    // 文件夹父亲节点的路径
    fatherName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "Appstore/",
      comment: "父亲节点的名字",
    },
    selfPath: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "Appstore/",
      comment: "文件夹本身路径",
    },
    docContain: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "文件夹 包含的文件夹",
    },
    fatherId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 1,
      comment: "文件夹父亲节点的ID",
    },
    fileContainInfo: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "文件夹包含的文件",
    },
    fileKind: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: "文件夹",
    },
    iconUrl: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "file.png",
    },
  },
  {
    paranoid: true,
  }
);

module.exports = Document;
